package
{
	import flash.utils.describeType;
	
	import mx.collections.ArrayCollection;
	
	[Bindable]
	public class Registration
	{
		public var pfname:String="";
		public var plname:String="";
		public var pemail:String="";
		public var phomephone:String="";
		public var pmphone:String="";
		public var sfname:String="";
		public var slname:String="";
		public var semail:String="";
		public var smphone:String="";
		public var ecfname:String="";
		public var eclname:String="";
		public var ecphone:String="";
		public var addr1:String="";
		public var addr2:String="";
		public var city:String="";
		public var zip:String="";
		public var comments:String="";
		public var allergies:String="";
	    public var kid1Fname:String="";
	    public var kid1Lname:String="";
	    public var kid1DobString:String="";
	    public var kid1Grade:String="";
	    public var kid1Sex:String="";
	    public var kid1ShirtSize:String="";	    
	    public var kid2Fname:String="";
	    public var kid2Lname:String="";
	    public var kid2DobString:String="";
	    public var kid2Grade:String="";
	    public var kid2Sex:String="";
	    public var kid2ShirtSize:String="";
	    public var kid3Fname:String="";
	    public var kid3Lname:String="";
	    public var kid3DobString:String="";
	    public var kid3Grade:String="";
	    public var kid3Sex:String="";
	    public var kid3ShirtSize:String="";
	    public var kid4Fname:String="";
	    public var kid4Lname:String="";
	    public var kid4DobString:String="";
	    public var kid4Grade:String="";
	    public var kid4Sex:String="";
	    public var kid4ShirtSize:String="";
	    public var kid5Fname:String="";
	    public var kid5Lname:String="";
	    public var kid5DobString:String="";
	    public var kid5Grade:String="";
	    public var kid5Sex:String="";
	    public var kid5ShirtSize:String="";
	    
		
		public var kids:ArrayCollection=new ArrayCollection();
		
		public function Registration()
		{
		}
		
		public function populateKids():void {
			var kid:Kid=null;			
			for (var i:Number=0; i<5; i++) {
				kid=kids.getItemAt(i) as Kid;						
				var j:Number=i+1;
				this["kid"+j+"Fname"]=kid.fname;
				this["kid"+j+"Lname"]=kid.lname;
				this["kid"+j+"DobString"]=kid.dob;
				this["kid"+j+"Grade"]=kid.grade;
				this["kid"+j+"Sex"]=kid.sex;
				this["kid"+j+"ShirtSize"]=kid.shirtSize;
			}
		}
		
		public function clear():void {
            var classInfo:XML = describeType(this);
            for each (var v:XML in classInfo..accessor) {
                if ( v.@type == "String" ) {
                	this[v.@name]="";
                } 
            }
		}
	}
}